using System;
using CommandSystem;

namespace CustomCharacter.Commands.AbilityManagerCommands
{
    public class AbilityManagerCommand : ParentCommand, IUsageProvider
    {
        public AbilityManagerCommand() => LoadGeneratedCommands();

        public override string Command => "abilitymanager";

        public override string[] Aliases => new string[] { "am" };

        public override string Description => "技能控制";

        public string[] Usage => new string[] { "grant/revoke/list", "玩家ID(查询list时可选)", "技能ID(grant时必要)" };

        public override void LoadGeneratedCommands()
        {
            this.RegisterCommand(new Grant());
            this.RegisterCommand(new List());
            this.RegisterCommand(new Revoke());
        }

        protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender,
            out string response)
        {
            if (!sender.CheckPermission(PlayerPermissions.ForceclassWithoutRestrictions))
            {
                response = "你没有权限使用这条命令！（需要权限：ForceclassWithoutRestrictions）";
                return false;
            }

            response = "用法： abilitymanager(am) <grant/revoke/list> <玩家ID(list可选)> <技能ID(grant必要)>";
            return false;
        }
    }
}